Skip to content

Conversation

@sahehb
Copy link
Collaborator

@sahehb sahehb commented Jan 20, 2026

MLAB-6216
MLAB-6212
MLAB-6201

MLAB-6216
MLAB-6212
MLAB-6201
@github-actions
Copy link

github-actions bot commented Jan 20, 2026

A preview of 8899f1c is uploaded and can be seen here:

https://mevislab.github.io/examples/pull/133/

Changes may take a few minutes to propagate. Since this is a preview of production, content with draft: true will not be rendered. The source is here: https://github.com/MeVisLab/examples/tree/gh-pages/pull/133/

@sahehb sahehb merged commit 3272c84 into main Jan 20, 2026
1 check passed
@sahehb sahehb deleted the MLAB-6218 branch January 20, 2026 11:07
### Write Test Functions in Python

{{<alert class="info" caption="Info">}}
In this example, we are using the **ASSERT*** functionalities, becase they throw an exception in case the expected value does not match the actual value. Your test execution stops in this case.
Copy link
Contributor

@okonrad okonrad Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: becase -> because

in case -> in the case (bei 'in case' schwingt Dringlichkeit mit z.B. 'in case of fire...'; 'in the case' bedeutet einfach so viel wie 'if')

{{<alert class="info" caption="Info">}}
In this example, we are using the **ASSERT*** functionalities, becase they throw an exception in case the expected value does not match the actual value. Your test execution stops in this case.

You can also use **EXPECT*** functions. They return *true* or *false* and you can decide yourself ho your test continues.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use 'True or False' to match the capitalization in Python.

typo: ho -> how


MeVisLab provides two options to compare a test result with an expected result:
#### ASSERT
Multiple **ASSERT_*** functions to compare expected and actual result are available, for example **ASSERT_EQ()** (check if two values are equal) or **ASSERT_GT()** (check if value is greater than another value).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma after 'for example': ... available, for example, ASSERT_EQ()...

#### ASSERT
Multiple **ASSERT_*** functions to compare expected and actual result are available, for example **ASSERT_EQ()** (check if two values are equal) or **ASSERT_GT()** (check if value is greater than another value).

In case an assertion fails, an exception is thrown and the test execution stops.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case... -> In the case...

Siehe oben


In case an assertion fails, an exception is thrown and the test execution stops.
#### EXPECT
The same comparisons can be done by using **EXPECT_***. The functions return *true* or *false* and depending on the result you can decide how to proceed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auch hier lieber True und False schreiben (wie in Python).


The value of our `DicomImport`s *progress* field is saved as the *currentValue* variable and compared to the *expectedValue* variable by calling *ASSERT_FLOAT_EQ(expectedValue,currentValue)* to determine if the DICOM import has finished (*currentValue* and *expectedValue* are equal) or not.

You can play around with the differences between **ASSERT_FLOAT_EQ()** and **EXPECT_FLOAT_EQ()** and le your test fail to see the differences.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: le -> let

* Tests can be executed on networks and macro modules.
* The test results are shown in a ReportViewer.
* **ASSERT*** functions throw an exception if the expected result differs from the actual result. The test run is aborted in such a case.
* **EXPECT*** functions return *true* or *false*. You can decide yoursel how to continue your test.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lieber True und False wie in Python schreiben.

typo: yoursel -> yourself


{{<alert class="info" caption="Info">}}
You can use many other *ASSERT** possibilities, just try using the MATE autocompletion and play around with them.
You can use many other **ASSERT*** possibilities, just try using the MATE autocompletion and play around with them. **ASSERT*** functions throw an exception in case expected and actul values do not fit. Your test execution stops in this case.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case -> in the case
typo: actul -> actual

You can use many other *ASSERT** possibilities, just try using the MATE autocompletion and play around with them.
You can use many other **ASSERT*** possibilities, just try using the MATE autocompletion and play around with them. **ASSERT*** functions throw an exception in case expected and actul values do not fit. Your test execution stops in this case.

You can also use **EXPECT*** functions. They return *true* or *false* and you can decide yourself ho your test continues.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lieber True und False wie in Python schreiben.

typo: ho -> how

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants